/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package byblos.apresentacao.idioma;

import byblos.negocio.Idioma;
import org.vraptor.Interceptor;
import org.vraptor.LogicException;
import org.vraptor.LogicFlow;
import org.vraptor.annotations.In;
import org.vraptor.annotations.Out;
import org.vraptor.scope.ScopeType;
import org.vraptor.view.ViewException;

/**
 *
 * @author Marco Aurélio
 */
public class InterceptadorIdioma implements Interceptor {

    @Out
    @In(scope = ScopeType.SESSION, required = false)
    private Idioma idioma;

    public void intercept(LogicFlow fluxo) throws LogicException, ViewException {
        if (idioma == null) {
            idioma = Idioma.PORTUGUES;
        }
        fluxo.execute();
    }
}
